package com.sagframe.sagacity.sqltoy.plus.chain.update;

import com.sagframe.sagacity.sqltoy.plus.chain.ChainDao;
import com.sagframe.sagacity.sqltoy.plus.conditions.interfaces.SFunction;
import com.sagframe.sagacity.sqltoy.plus.conditions.segments.MergeSegments;
import com.sagframe.sagacity.sqltoy.plus.conditions.toolkit.LambdaUtils;

import java.util.concurrent.atomic.AtomicInteger;

public class LambdaChainUpdateWrapper<T> extends AbstractChainUpdateQueryWrapper<T, SFunction<T, ?>, LambdaChainUpdateWrapper<T>> {

    public LambdaChainUpdateWrapper(Class<T> entityClass, ChainDao chainDao) {
        this(new MergeSegments(), entityClass, chainDao);
    }

    protected LambdaChainUpdateWrapper(MergeSegments expression, Class<T> entityClass, ChainDao chainDao) {
        super(expression, entityClass, chainDao);
    }

    protected LambdaChainUpdateWrapper(MergeSegments expression, AtomicInteger paramNameSeq, Class<T> entityClass) {
        super(expression, paramNameSeq, entityClass);
    }

    @Override
    protected LambdaChainUpdateWrapper<T> instance() {
        return new LambdaChainUpdateWrapper<>(new MergeSegments(), paramNameSeq, entityClass);
    }

    @Override
    protected String columnToString(SFunction<T, ?> column) {
        return LambdaUtils.extractToFiled(column);
    }
}
